{extend name="layout" /}
{block name="content"}
<div class="layui-tab layui-tab-brief">
	<ul class="layui-tab-title">
	    <li><a href="{:url('index')}">{$pathCurrent['name']}</a></li>
	    <li class="layui-this">{empty name="info"}新增{else /}编辑{/empty}客户</li>
  	</ul>
</div>
<div class="layui-card-body">
	<form class="layui-form" data-model="form-submit">
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		  	<legend>基本设置</legend>
		</fieldset>
		<div class="layui-form-item">
			<label class="layui-form-label">客户编号</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="customer_sn" value="{$info['customer_sn']}">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">客户名称</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="customer_name" value="{$info['customer_name']}" datatype="*">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">客户分类</label>
			<div class="layui-input-block">
				<select name="cid">
					{foreach $list as $vo}
					<option value="{$vo['id']}" {if $vo['id'] eq $info['cid']['value']}selected{/if}>{$vo['cname']|raw}</option>
					{/foreach}
				</select>
			</div>
		</div>
		<style>
			.layui-form-selected dl{
				z-index: 9999;
			}
		</style>
		 <div class="layui-form-item" >
			<label class="layui-form-label">选择地区</label>
			<div class="layui-input-block">
				<div class="layui-form-item" id="picker" style="clear: inherit;">
					<div class="layui-input-inline" style="width: 200px;">
					<select name="province" class="province-selector" data-value="{$info.province}" lay-filter="province-1">
						<option value="">请选择省</option>
					</select>
					</div>
					<div class="layui-input-inline" style="width: 200px;">
					<select name="city" class="city-selector" data-value="{$info.city}" lay-filter="city-1">
						<option value="">请选择市</option>
					</select>
					</div>
					<div class="layui-input-inline" style="width: 200px;">
					<select name="county" class="county-selector" data-value="{$info.county}" lay-filter="county-1">
						<option value="">请选择区</option>
					</select>
					</div>
				</div>
			</div>
        </div>
        <div class="layui-form-item">
			<label class="layui-form-label">详细地址</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="address" value="{$info['address']}">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">负责人</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="name" value="{$info['name']}">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">手机号码</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="phone" value="{$info['phone']}">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">客户描述</label>
			<div class="layui-input-block">
				<textarea id="content" name="content" data-model="form-ueditor" placeholder="">{$info['content']|raw}</textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">客户排序</label>
			<div class="layui-input-block">
				<input type="text" class="layui-input" name="sort" value="{$info['sort'] ? $info['sort'] : '99'}">
			</div>
		</div>
		<div class="layui-form-item">
	    	<label class="layui-form-label">状态</label>
	    	<div class="layui-input-block">
	    		{php}$state = isset($info['status']) ? $info['status'] : '1';{/php}
	      		<input type="radio" name="status" value="1" title="启用" {if $state eq 1} checked="" {/if}>
	      		<input type="radio" name="status" value="2" title="冻结" {if $state eq 2} checked="" {/if}>
	    	</div>
	  	</div>
		<div class="layui-form-item">
	    	<div class="layui-input-block">
	    		<input type="hidden" name="id" value="{$info['id']}">
	      		<button class="layui-btn layui-btn-normal">保存</button>
	      		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    	</div>
	  	</div>
	</form>
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="/static/lib/assets/data.js"></script>
<script type="text/javascript">
    var mixin = {};
    layui.config({
		base: '/static/lib/mods/'
		, version: '1.0'
	});
    layui.use(['form','layarea'],function(){
        var form = layui.form
        var layarea = layui.layarea
        
        layarea.render({
            elem: '#picker',
            // data: addrData,
            change: function (res) {
                //选择结果
                var str = JSON.stringify(res);
                if( res.province != '请选择省' && res.city != '请选择市' && res.county != '请选择区' ){
                    var str = JSON.stringify(res);
                }else{
                    // alert('地区选择错误');
                    str = '';
                }
            }
        });
        




    });
</script>
{/block}